import { defineApis } from '@/utils/api'

//查询字典根项列表
const queryRootDictItems = {
    url: `/dict/root`,
}

//列出某个字典根项的子项列表
function listSubDictItems(id: number | undefined, code?: string) {
    return {
        url: `/dict/sub-items`,
        params: {
            id,
            code
        }
    };
}

//添加字典子项
function addSubDictItem(dict?: any) {
    return {
        url: `/dict/sub-item`,
        method: 'POST',
        data: dict
    };
}

//删除字典项
function removeDictItem(id: number) {
    return {
        url: `/dict/${id}`,
        method: 'DELETE',
    };
}

//获取服务名列表
const listServices = {
    url: `/dict/services`,
}

export default defineApis('admin', {
    queryRootDictItems,
    listSubDictItems,
    addSubDictItem,
    removeDictItem,
    listServices
})